package com.jsp.study.listener;

import java.util.Vector;

/**
 * 用来储存在线用户和对在线用户进行具体操作
 * @author xubin0
 *
 */
public class UserInfoList {
	
	private static UserInfoList user = new UserInfoList();
	private Vector vector = null;
	
	/**
	 * 利用private调用构造函数，防止被外界产生新的instance对象
	 */
	public UserInfoList() {
		this.vector = new Vector();
	}
	
	public static UserInfoList getInstance() {
		return user;
	}
	
	public boolean addUserInfo(String user) {
		if (user != null) {
			this.vector.add(user);
			return true;
		} else {
			return false;
		}
	}
	
	public Vector getList() {
		return vector;
	}
	
	public void removeUserInfo(String user) {
		if (user != null) {
			vector.removeElement(user);
		}
	}
	
}
